package org.dromara.wms.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.tenant.core.TenantEntity;
import org.dromara.wms.domain.productPC.Sku;
import org.dromara.wms.domain.productPC.Spec;

import java.io.Serial;
import java.util.Date;
import java.util.List;

/**
 * 产品管理对象 wms_product
 *
 * @author wenrui
 * @date 2024-03-20
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_product")
public class WmsProduct extends TenantEntity {

  @Serial
  private static final long serialVersionUID = 1L;

  /**
   * 产品子id
   */
  @TableId(value = "id")
  private Long id;

  @ExcelProperty(value = "产品编码")
  private String sku;

  @NotBlank(message = "产品名称不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "产品名称")
  private String name;

  @ExcelProperty(value = "产品规格")
  private String specification;

  @ExcelProperty(value = "包装单位")
  private String packingUnit;

  @NotBlank(message = "计量单位不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "计量单位")
  private String measureUnit;

  @ExcelProperty(value = "包装数量")
  private String packingQuantity;

  @NotNull(message = "价格不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "价格")
  private Double price;

  @ExcelProperty(value = "采购价")
  private Double purchasePrice;

  @ExcelProperty(value = "类别")
  private String treeValue;

  @ExcelProperty(value = "产品属性")
  private String attrValue;

  @NotBlank(message = "产品状态不能为空", groups = {AddGroup.class, EditGroup.class})
  @ExcelProperty(value = "产品状态", converter = ExcelDictConvert.class)
  @ExcelDictFormat(dictType = "sys_status")
  private String status;

  @ExcelProperty(value = "产品归属商城菜单id")
  private Long mallMenuId;

  @TableField(value = "`desc`")
  private String desc;

  private Double oldPrice;

  @ExcelProperty(value = "是否库存")
  private Boolean isStock;

  @ExcelProperty(value = "可否销售")
  private Boolean isSales;

  @ExcelProperty(value = "可否采购")
  private Boolean isPurchase;

  @ExcelProperty(value = "可否生产")
  private Boolean isProduce;

  @ExcelProperty(value = "是否物料")
  private Boolean isMaterial;

  @ExcelProperty(value = "委外加工")
  private Boolean isOutsource;

  @ExcelProperty(value = "最低库存")
  private Double minStock;

  @ExcelProperty(value = "最大库存")
  private Double maxStock;

  @ExcelProperty(value = "更新时间")
  private Date updateTime;

  @ExcelProperty(value = "备注")
  private String remark;

  /*
  * 其他字段
  * */

  @TableField(exist = false)
  private String url;

  @TableField(exist = false)
  private List<Long> ids;

  @TableField(exist = false)
  private List<WmsProductOss> productOss;

  @TableField(exist = false)
  private List<String> mainPictures;

  @TableField(exist = false)
  private Long inventory;

  //产品规格
  @TableField(exist = false)
  private List<Spec> specs;

  //产品组下的全部产品
  @TableField(exist = false)
  private List<Sku> skus;

  //wms_group 中的规格
  @TableField(exist = false)
  private String attrValueName;

}



